package com.liuhengjia.langchain4japply.api;

import com.liuhengjia.langchain4japply.config.assistant.Assistant;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 联网搜索 API
 */
@RestController
@RequestMapping("/api/web-search")
@RequiredArgsConstructor
public class WebSearchAPI {
    private final Assistant webSearchAssistant;

    /**
     * 高级聊天
     *
     * @param message 用户信息
     * @return 模型响应
     */
    @GetMapping("/high/chat")
    public String highChat(@RequestParam(value = "message") String message) {
        return webSearchAssistant.chat(message);
    }
}
